Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DEPR: returning tuple when grouping by a list containing single element #47761

Merged
merged 129 commits into from
Aug 1, 2022

Conversation

ahmedibrhm
Copy link
Contributor

@ahmedibrhm ahmedibrhm commented Jul 17, 2022

Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good! I think we're just about there. Some last minor comments.

@@ -774,6 +774,7 @@ Other Deprecations
- Deprecated :meth:`Series.rank` returning an empty result when the dtype is non-numeric and ``numeric_only=True`` is provided; this will raise a ``TypeError`` in a future version (:issue:`47500`)
- Deprecated argument ``errors`` for :meth:`Series.mask`, :meth:`Series.where`, :meth:`DataFrame.mask`, and :meth:`DataFrame.where` as ``errors`` had no effect on this methods (:issue:`47728`)
- Deprecated arguments ``*args`` and ``**kwargs`` in :class:`Rolling`, :class:`Expanding`, and :class:`ExponentialMovingWindow` ops. (:issue:`47836`)
- Deprecated producing a single element when using :meth:`Pandas.groupby` with a single list element. A tuple of length one will be returned instead.
Copy link
Member

@rhshadrach rhshadrach Jul 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to mention iterating over the groupby. Something like

a single element when iterating over a :class:DataFrameGroupBy or :class:SeriesGroupBy that has been grouped by a list of length 1; a tuple of length...

Also, no period at the end and add the issue number at the end (as in the lines above).

Copy link
Member

@rhshadrach rhshadrach Jul 29, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The end of the whatsnew note looks good - but saying :meth:`Pandas.groupby` is incorrect (there is no pandas.groupby method). See my suggestion above.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rhshadrach sorry didn't notice. How about now?

pandas/core/groupby/groupby.py Outdated Show resolved Hide resolved
pandas/core/groupby/ops.py Outdated Show resolved Hide resolved
pandas/plotting/_matplotlib/groupby.py Show resolved Hide resolved
pandas/tests/groupby/test_groupby.py Outdated Show resolved Hide resolved
@ahmedibrhm
Copy link
Contributor Author

@rhshadrach Thanks a lot for your effort and reviews! How does it look now?

@ahmedibrhm
Copy link
Contributor Author

@rhshadrach How does it look now?

doc/source/whatsnew/v1.5.0.rst Outdated Show resolved Hide resolved
Co-authored-by: Richard Shadrach <45562402+rhshadrach@users.noreply.github.com>
Copy link
Member

@rhshadrach rhshadrach left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks for handling all the requests!

Copy link
Member

@mroeschke mroeschke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After the merge conflict is reserved, LGTM

@mroeschke mroeschke added this to the 1.5 milestone Aug 1, 2022
@mroeschke mroeschke merged commit 14de3fd into pandas-dev:main Aug 1, 2022
@mroeschke
Copy link
Member

Thanks @ahmedibrhm! Very nice

@jbrockmendel
Copy link
Member

@ahmedibrhm this is producing a bunch of warnings in the tests. any chance you can update the relevant tests to avoid/catch these warnings?

@mroeschke
Copy link
Member

@ahmedibrhm this is producing a bunch of warnings in the tests. any chance you can update the relevant tests to avoid/catch these warnings?

I think I caught a lot of them in #48159

@jbrockmendel
Copy link
Member

@ahmedibrhm want to make a PR enforcing this deprecation?

@rhshadrach
Copy link
Member

@jbrockmendel - I'm going to pick this up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Deprecate Functionality to remove in pandas Groupby
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: consistent types in output of df.groupby
5 participants